package com.ruoyi.web.sso.task;


import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.web.sso.service.ILiveRoomService;
import com.ruoyi.web.sso.util.HttpUtil;
import com.ruoyi.web.sso.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 摄像头定时任务
 * 
 * @author #
 */
@Component
@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
public class LiveRoomTask
{
    @Autowired
    private ILiveRoomService liveRoomService;

    @Scheduled(cron = "0 30 * * * ?")
    private void configureTasks() {
//        System.out.println("-----------------" +"摄像头任务开始"+"-----------------------------");
//        liveRoomService.closeLive();
//        System.out.println("-----------------" +"摄像头任务结束"+"-----------------------------");
    }

    public static void main(String[] args) {

        String details = "[{\"label\":\"周次\",\"value\":\"第一周\"},{\"label\":\"月龄\",\"value\":\"undefined-undefined\"},{\"label\":\"面向\",\"value\":\"音乐活动\"},{\"label\":\"教材\",\"value\":\"\"},{\"label\":\"课堂时间\",\"value\":\"10分钟\"}]";
        List<Map> maps = JSONArray.parseArray(details, Map.class);
        maps.stream().forEach(o->{
            if (StringUtils.equals(o.get("label").toString(),"月龄")){
                o.put("value","1-1");
            }
        });
        System.out.println(StringUtils.equals("1","2") ? 1:2);
    }
}
